import React, { Component } from 'react';
import { Modal, Button, Form, Input, Select, Radio, Checkbox, Row, Col } from 'antd';
import { ExclamationCircleOutlined } from '@ant-design/icons';
import Enum from '../Enum'
import './style.less'
import moment from 'moment';
import TheUpload from "@/components/TheUpload";
import { apiMemberReviewDispose, apiMemberAppealRecordsDetail, apiFindBlockingRecordsByMemberIdList, apiGetMemberReviewRecordsDetail, apiMemberAppealRecordsConfirm, apiMemberReviewRecordsGetMemberProperty } from '@/request/riskControl'
const { TextArea } = Input;
const { Option } = Select

export default class HandleDialog extends Component {
    constructor(props) {
        super(props)
        this.formRef = React.createRef()
        this.state = {
            mode: 'F',// F  风控封禁   J  风控解禁  UF 账号封禁  UJ 账号解禁  CF 功能封禁   CJ 功能解禁 
            type: "user", // user  账号  content 宠圈内容
            from: 'report',//report 举报  appeal 申诉
            visible: false,
            loading: false,
            timeData: {},
            fileList: [],
            dataInfo: {},
            historySights: [], //已经被封禁的功能-解禁时用
            blockingRecordsByMemberIdList: {},// 已经被封禁的功能-封禁时用
            blockingRecordsByMemberIdListKey2Time: {},
            id: '',	//业务id 举报id / 申诉id
            hasBannedAccount: false,
            nickName: ''
        }
    }
    componentDidMount() {
    }

    typeChange = (e, key) => {
        const value = e.target.value
        const { timeData } = this.state
        timeData[key] = {
            type: value,
            value: "1"
        }
        this.setState({
            timeData: {}
        }, () => {
            this.setState({ timeData })
            console.log(timeData);

        })

    }
    timeChange = (value, key) => {
        console.log(value, key);
        const { timeData } = this.state
        timeData[key] = {
            type: 'someTime',
            value: value
        }
        this.setState({
            timeData: {}
        }, () => {
            this.setState({ timeData })
        })

    }

    getOverTime = (hour) => {
        const now = new Date().getTime()
        const stime = hour * 60 * 60 * 1000
        return moment(stime + now).format('YYYY-MM-DD HH:mm:ss')
    }
    // 上传图片
    getFileResult = (value) => {
        if (value.length) {
            let str = value.map(v => {
                if (v.response && v.response.code === 0) {
                    return v.response.data
                }
            }).join(',')
            this.formRef.setFieldsValue({ disposeImages: str });
        } else {
            this.formRef.setFieldsValue({ disposeImages: '' });
        }
    };
    getTitle = () => {
        const { mode, type } = this.state
        if (mode === 'UF') {
            if (type === 'user') {
                return '账号封禁'
            } else if (type == 'content') {
                return '功能封禁'
            }
        } else if (mode === 'UJ') {
            if (type === 'user') {
                return '账号解禁'
            } else if (type == 'content') {
                return '功能解禁'
            }
        } else if (mode === 'CJ') {
            return '功能解禁'

        } else if (mode === 'CF') {
            return '功能封禁'

        } else if (mode === 'F') {
            return '封禁'

        } else if (mode === 'J') {
            return '解禁'

        }
        return '封禁'

    }
    getData() { }
    // 打开弹窗
    open(option) {
        const { mode, type, from, id, nickName } = option
        console.log(option, '111111111');
        this.setState({
            timeData: {},
            fileList: [],
            dataInfo: {},
            historySights: [], //已经被封禁的功能-解禁时用
            blockingRecordsByMemberIdList: {},// 已经被封禁的功能-封禁时用
            blockingRecordsByMemberIdListKey2Time: {},
            id: '',	//业务id 举报id / 申诉id
            nickName: ''
        }, () => {
            if (from === 'report') {//举报
                apiGetMemberReviewRecordsDetail(id).then(res => {
                    if (res.code == 0) {
                        const { blockingRecordsByMemberIdList } = res.data
                        let sights = {}
                        const key2Time = {}
                        let hasBannedAccount = false
                        blockingRecordsByMemberIdList.map(item => {
                            const { bannedTimeType, bannedType, bannedTime, bannedEndTime } = item
                            sights[bannedType] = bannedTimeType
                            key2Time[bannedType] = bannedEndTime
                            if (bannedType == 'MEMBER_ACCOUNT' || bannedType == 'MEMBER_FUNCTION') {
                                hasBannedAccount = true
                            }
                        })
                        this.setState({
                            dataInfo: {
                                ...res.data
                            },
                            blockingRecordsByMemberIdList: sights,
                            blockingRecordsByMemberIdListKey2Time: key2Time,
                            nickName,
                            mode, type, from, id, hasBannedAccount
                        }, () => {  
                            
                            this.setState({
                                visible: true,
                            })
                        })


                    }
                })
            } else if (from === 'appeal') {//申诉
                apiMemberAppealRecordsDetail({ appealId: id }).then(res => {
                    if (res.code === 0) {
                        const { blockingRecords } = res.data
                        let sights = blockingRecords.map(item => {
                            const { bannedTime, bannedType } = item
                            return bannedType
                        })
                        this.setState({
                            dataInfo: {
                                ...res.data
                            },
                            nickName,
                            historySights: sights,
                            mode, type, from, id
                        }, () => {
                            this.setState({
                                visible: true,
                            })
                        })
                    }
                })
            } else if (from == 'person') {
                apiFindBlockingRecordsByMemberIdList({ memberId: id }).then(res => {
                    if (res.code === 0 && res.data) {
                        if (mode === 'CJ') {
                            let sights = res.data.map(item => {
                                const { bannedTimeType, bannedType } = item
                                return bannedType
                            })
                            this.setState({
                                dataInfo: {
                                    memberId: id
                                },
                                nickName,
                                historySights: sights,
                                mode, type, from, id
                            }, () => {
                                this.setState({
                                    visible: true,
                                })
                            })
                        } else if (mode === 'CF') {
                            let sights = {}
                            const key2Time = {}
                            let hasBannedAccount = false
                            res.data.map(item => {
                                const { bannedTimeType, bannedType, bannedTime, bannedEndTime } = item
                                sights[bannedType] = bannedTimeType
                                key2Time[bannedType] = bannedEndTime
                                if (bannedType == 'MEMBER_ACCOUNT') {
                                    hasBannedAccount = true
                                }

                            })
                            this.setState({
                                dataInfo: {
                                    memberId: id
                                },
                                blockingRecordsByMemberIdList: sights,
                                blockingRecordsByMemberIdListKey2Time: key2Time,
                                mode, type, from, id, hasBannedAccount,
                                nickName
                            }, () => {
                                this.setState({
                                    visible: true,
                                })
                            })
                        } else if (mode === 'UJ') {
                            let sights = {}
                            res.data.map(item => {
                                const { bannedTimeType, bannedType } = item
                                sights[bannedType] = bannedTimeType
                            })
                            this.setState({
                                dataInfo: {
                                    memberId: id
                                },
                                blockingRecordsByMemberIdList: sights,
                                nickName,
                                mode, type, from, id
                            }, () => {
                                this.setState({
                                    visible: true,
                                })
                            })
                        } else if (mode === 'UF') {
                            let sights = {}
                            res.data.map(item => {
                                const { bannedTimeType, bannedType } = item
                                if (bannedType === 'MEMBER_ACCOUNT') {
                                    sights['MEMBER_ACCOUNT'] = bannedTimeType
                                }
                            })
                            this.setState({
                                dataInfo: {
                                    memberId: id
                                },
                                blockingRecordsByMemberIdList: sights,
                                nickName,
                                mode, type, from, id,
                            }, () => {
                                this.setState({
                                    visible: true,
                                })
                            })
                        }

                    }
                })
            }
        })

    }
    // 提 交
    handleOk = () => {
        const _this = this
        this.formRef.validateFields().then((values) => {
            const { mode, id, dataInfo, blockingRecordsByMemberIdList, type, from } = this.state
            const { state, reportMethod, sights } = values
            const userManagementReport = ((mode === 'CF' || mode === 'CJ'|| mode === 'UF'|| mode === 'UJ') && type === 'user' && from === 'person')  // 是否是用户管理---封禁
            console.log(mode, state);
            if ((mode === 'F' || mode === 'CF' || mode === 'UF') && (state == 'BLOCKED' || state == 'BANNED' || userManagementReport)) {
                const bannedTypeStr = []
                if (state == 'BLOCKED' || (mode === 'CF'&& type === 'user' && from === 'person') ) {
                    values.sights.forEach(item => {
                        if (item.riskMode && item.riskMode.length > 0) {
                            if (item.value in blockingRecordsByMemberIdList) return
                            bannedTypeStr.push(item.value)
                        }
                    })
                }

                apiMemberReviewRecordsGetMemberProperty({ memberId: !userManagementReport ? dataInfo.reportMemberId : id, bannedType: state == 'BLOCKED' || (userManagementReport&& mode =='CF') ? bannedTypeStr.join(',') : reportMethod }).then(res => {
                    if (res.data == 1) {
                        Modal.confirm({
                            title: '提醒',
                            icon: <ExclamationCircleOutlined />,
                            content: <div> 该举报对象（
                                {
                                    <a onClick={() => {

                                        const w = window.open('about:blank');
                                        w.location.href = `/gl/#/users/details/${!userManagementReport ? dataInfo.reportMemberId : id}?mode=blank`

                                    }

                                    }>{!userManagementReport ? dataInfo.reportMemberId : id}/{!userManagementReport ? dataInfo.reportMemberName : this.state.nickName}</a>
                                }
                                ）账户中存在资产待处理，是否继续账号封禁？

                            </div>,
                            onOk() {
                                _this.onSave()
                            },
                            onCancel() { },
                        });
                    } else {
                        _this.onSave()

                    }

                })
            } else {
                _this.onSave()

            }

        })



    }
    onSave = () => {
        this.formRef.validateFields().then((values) => {
            console.log(values);
            const { disposeImages, sights, state, disposeOpinion, contentState, WARNINGTxt, } = values
            const { mode, type, from, blockingRecordsByMemberIdList, historySights, dataInfo, id } = this.state
            const memberOperationDTOList = []
            let applyData = {}
            const userManagementReport = ((mode === 'CF' || mode === 'CJ'||mode === 'UF'||mode === 'UJ') && type === 'user' && from === 'person')  // 是否是用户管理---封禁

            //审核封禁
            if (mode === 'F' || mode === 'CF') {
                if (state == 'BANNED') {//账号封禁
                    console.log(values, '::::BANNED');
                    memberOperationDTOList.push({
                        bannedMemberId: dataInfo.reportMemberId,
                        "capability": values.reportMethod,
                        "operation": state,
                        dataId: dataInfo.dataId,
                        dataValue: '',
                        extendText: disposeImages,
                        handlingSuggestion: disposeOpinion,
                        processId: id,
                        reportMemberId: dataInfo.memberId,
                        unsealHours: values.timeType === 'someTime' ? values.time : ''
                    })
                } else if (state === 'WARNING' || state == 'IGNORE') {
                    memberOperationDTOList.push({
                        bannedMemberId: dataInfo.reportMemberId,
                        "capability": dataInfo.reviewType,
                        "operation": state,
                        dataId: dataInfo.dataId,
                        dataValue: state === 'WARNING' ? WARNINGTxt : '',
                        extendText: disposeImages,
                        handlingSuggestion: disposeOpinion,
                        processId: id,
                        reportMemberId: dataInfo.memberId,
                        unsealHours: ''
                    })
                } else if (state === 'BLOCKED' || userManagementReport) {
                    sights && sights.forEach(item => {
                        const { riskMode, time, timeType, value } = item
                        if (riskMode && riskMode.length > 0) {
                            if (value in blockingRecordsByMemberIdList) return
                            memberOperationDTOList.push({
                                bannedMemberId: userManagementReport ? id : dataInfo.reportMemberId,
                                "capability": value,
                                "operation": userManagementReport ? 'BLOCKED' : state,
                                dataId: userManagementReport ? id : dataInfo.dataId,
                                dataValue: '',
                                extendText: disposeImages,
                                handlingSuggestion: disposeOpinion,
                                processId: userManagementReport ? '' : id,
                                reportMemberId: userManagementReport ? '' : dataInfo.memberId,
                                unsealHours: timeType === 'someTime' ? time : ''
                            })
                        }
                    })
                }
                // 宠圈、动态
                if (type === 'content') {
                    memberOperationDTOList.push({
                        bannedMemberId: dataInfo.reportMemberId,
                        "capability": dataInfo.reviewType + "_UNDERCARRIAGE",
                        "operation": contentState,
                        dataId: dataInfo.dataId,
                        extendText: disposeImages,
                        handlingSuggestion: disposeOpinion,
                        processId: id,
                        reportMemberId: dataInfo.memberId,
                        unsealHours: ''
                    })
                }
                applyData = {
                    memberOperationDTOList,
                    disposeImages,
                    disposeOpinion,
                    memberReviewRecordsId: userManagementReport ? '' : this.state.id
                }
                apiMemberReviewDispose(applyData).then(res => {
                    if (res.code == 0) {
                        React.$message({
                            type: "success",
                            content: "操作成功",
                        });
                        this.props.getData()
                        this.handleCancel()

                    } else {
                        React.$message({
                            type: "error",
                            content: res.codeMessage,
                        });
                    }
                })
            } else if (mode === 'J' || mode === 'CJ') {
                console.log(sights);
                sights && sights.forEach(item => {
                    const { riskMode, time, timeType, value } = item
                    if (riskMode && riskMode.length > 0) {
                        memberOperationDTOList.push({
                            bannedMemberId: userManagementReport ? id : dataInfo.applicantId,
                            capability: value,
                            operation: 'UNBLOCKED',
                            dataId: userManagementReport ? id : (type === 'user' ? dataInfo.applicantId : dataInfo.commentId),
                            extendText: disposeImages,
                            handlingSuggestion: disposeOpinion,
                            processId: userManagementReport ? '' : id
                        })
                    }

                })
                if (type === 'content') {
                    memberOperationDTOList.push({
                        bannedMemberId: dataInfo.applicantId,
                        "capability": dataInfo.appealType + '_UNDERCARRIAGE',
                        "operation": contentState,
                        dataId: (type === 'user' ? dataInfo.applicantId : dataInfo.commentId),
                        extendText: disposeImages,
                        handlingSuggestion: disposeOpinion,
                        processId: id,
                    })
                }
                applyData = {
                    appealId: userManagementReport ? '' : this.state.id,//主键id
                    batchMemberOperationParam: {
                        memberOperationDTOList,
                    },
                    handlingOpinions: disposeOpinion,
                    handlingOpinionsImage: disposeImages,

                }
                console.log(applyData, 'applyData');
                apiMemberAppealRecordsConfirm(applyData).then(res => {
                    if (res.code == 0) {
                        React.$message({
                            type: "success",
                            content: "操作成功",
                        });
                        this.props.getData()
                        this.handleCancel()

                    } else {
                        React.$message({
                            type: "error",
                            content: res.codeMessage,
                        });
                    }
                })
            } else if (mode === 'UJ') {
                const memberOperationDTOList = [{
                    bannedMemberId: id,
                    capability: 'MEMBER_ACCOUNT',
                    operation: 'UNBLOCKED',
                    dataId: id,
                    extendText: disposeImages,
                    handlingSuggestion: disposeOpinion,
                    processId: ''
                }]
                applyData = {
                    appealId: '',//主键id
                    batchMemberOperationParam: {
                        memberOperationDTOList,
                    },
                    handlingOpinions: disposeOpinion,
                    handlingOpinionsImage: disposeImages,

                }
                apiMemberAppealRecordsConfirm(applyData).then(res => {
                    if (res.code == 0) {
                        React.$message({
                            type: "success",
                            content: "操作成功",
                        });
                        this.props.getData()
                        this.handleCancel()
                    } else {
                        React.$message({
                            type: "error",
                            content: res.codeMessage,
                        });
                    }
                })
            } else if (mode === 'UF') {

                const { timeType, time } = values
                const memberOperationDTOList = [{
                    bannedMemberId: id,
                    "capability": values.reportMethod,
                    "operation": 'BANNED',
                    dataId: id,
                    extendText: disposeImages,
                    handlingSuggestion: disposeOpinion,
                    processId: '',
                    reportMemberId: '',
                    unsealHours: values.timeType === 'someTime' ? values.time : ''
                }]
                applyData = {
                    memberOperationDTOList,
                    disposeImages,
                    disposeOpinion,
                    memberReviewRecordsId: ''
                }
                apiMemberReviewDispose(applyData).then(res => {
                    if (res.code == 0) {
                        React.$message({
                            type: "success",
                            content: "操作成功",
                        });
                        this.props.getData()
                        this.handleCancel()

                    } else {
                        React.$message({
                            type: "error",
                            content: res.codeMessage,
                        });
                    }
                })
            }

        })
    }
    // 关 闭
    handleCancel = () => {
        this.formRef.resetFields();
        this.setState({ visible: false })
    }
    onValuesChange = (values, allValue) => {
        console.log(values, allValue, 'aonValuesChange');
        const { mode, type, dataInfo } = this.state
        Object.keys(values).forEach(key => {
            if (key == 'state') {
                if (allValue.sights && allValue.sights.length > 0) {
                    this.formRef.setFieldsValue({
                        sights: allValue.sights.map(item => {
                            return {
                                ...item,
                                time: undefined,
                                riskMode: '',
                                timeType: ''
                            }
                        })
                    })
                }
                this.formRef.setFieldsValue({
                    reportMethod: '',
                    time: undefined,
                    timeType: ""
                })
                if (type === 'content' && mode === 'F' && values[key] === 'WARNING') {
                    if (dataInfo.reviewType == 'MEMBER_CIRCLE_DYNAMIC') {
                        this.formRef.setFieldsValue({
                            WARNINGTxt: '违反社区规则'
                        })
                    } else if (dataInfo.reviewType == 'MEMBER_CIRCLE_COMMENT') {
                        this.formRef.setFieldsValue({
                            WARNINGTxt: '发言不友善'
                        })
                    } else if (dataInfo.reviewType == 'MEMBER_ACCOUNT') {
                        this.formRef.setFieldsValue({
                            WARNINGTxt: '违反平台使用协议必填项'
                        })
                    }
                }
            } else if (key == 'reportMethod') {
                this.formRef.setFieldsValue({
                    timeType: '',
                    time: undefined,

                })
            }
        })
    }
    render() {
        const reviewDescType = 'groupMsg'//当前举报记录得类型 群聊 私聊 其他
        const { dataInfo, visible, loading, mode, type, fileList, historySights, blockingRecordsByMemberIdList, blockingRecordsByMemberIdListKey2Time, hasBannedAccount } = this.state
        const { handleState, reportState, appealState, commonHeaderTableIllegalType, reviewType, BANNED_state } = Enum
        const { appeal, report, contentState, appealContentState } = handleState
        const stateObj = mode == 'F' ? report : appeal
        const stateList = []//处理类型
        let sights = []
        Object.keys(stateObj).forEach(key => {
            if (type == 'user') {
                stateList.push({ label: stateObj[key], value: key, disabled: hasBannedAccount && key === 'BANNED' })
            } else if (type === 'content') {
                // if (stateObj[key] === '封禁') return
                stateList.push({ label: stateObj[key], value: key, disabled: hasBannedAccount && key === 'BANNED' })
            }
        })
        const timeOptions = Object.keys(commonHeaderTableIllegalType).map(key => {
            return { label: commonHeaderTableIllegalType[key], value: key }
        })
        const reportStateList = Object.keys(contentState).map(key => {
            return { label: contentState[key], value: key }
        })
        const appealContentList = Object.keys(appealContentState).map(key => {
            return { label: appealContentState[key], value: key }
        })
        if (mode === 'F' || mode === 'CF') {
            // 'MEMBER_CIRCLE_DYNAMIC': '宠圈动态',
            // 'MEMBER_CIRCLE_COMMENT': '宠圈评论',
            Object.keys(reportState).map(key => {
                if (dataInfo.reviewType === 'MEMBER_CIRCLE_DYNAMIC' && key === 'MEMBER_CIRCLE_COMMENT') return false
                if (dataInfo.reviewType === 'MEMBER_CIRCLE_COMMENT' && key === 'MEMBER_CIRCLE_DYNAMIC') return false
                // v2 赵青 功能封禁中去除账号封禁
                if (key === 'MEMBER_ACCOUNT') return false
                sights.push({
                    label: reportState[key],
                    value: key,
                    time: blockingRecordsByMemberIdList[key],
                    riskMode: key in blockingRecordsByMemberIdList ? key : '',
                    timeType: key in blockingRecordsByMemberIdList ? (blockingRecordsByMemberIdList[key] == 1 ? 'someTime' : 'always') : ''
                })
            })
        } else if (mode === 'J') {
            Object.keys(appealState).forEach(key => {
                if (historySights.includes(key)) {
                    sights.push({ label: appealState[key], value: key })
                }
            })
        } else if (mode === 'CJ') {
            Object.keys(appealState).forEach(key => {
                // 剔除未被封的功能
                if (historySights.includes(key)) {
                    sights.push({ label: appealState[key], value: key })
                }

            })
        }

        console.log(sights, 'sights');
        return (
            <>
                {
                    visible && <Modal
                        visible={visible}
                        title={this.getTitle()}
                        width={800}
                        onOk={this.handleOk}
                        onCancel={this.handleCancel}
                        footer={[
                            <Button onClick={this.handleCancel}>
                                关 闭
                            </Button>,
                            <Button type="primary" loading={loading} onClick={this.handleOk}>
                                提 交
                            </Button>,
                            <Button
                                key="link"
                                href="https://google.com"
                                type="primary"
                                loading={loading}
                                onClick={this.handleOk}
                            >

                            </Button>,
                        ]}
                    >
                        {
                            visible && <Form ref={ref => this.formRef = ref}
                                className='risk'
                                onValuesChange={this.onValuesChange}
                                initialValues={{
                                    sights,
                                    timeOptions
                                }}>
                                {/* 风控 用户封禁/解禁 */}

                                {
                                    mode === 'F' || mode == 'J' ? <Form.Item style={{ marginBottom: 20 }} label="处理类型" name={'state'} rules={[{ required: true, message: '请选择' }]}>
                                        <Select options={stateList} placeholder="请选择" allowClear />
                                    </Form.Item> : null
                                }
                                {/* 风控 用户封禁/解禁 or 用户功能封禁/解禁*/}
                                {
                                    <Form.Item noStyle shouldUpdate>
                                        {
                                            ({ getFieldValue }) => {
                                                const state = getFieldValue('state')
                                                if (state === 'BLOCKED' || state == 'UNBLOCKED' || mode === 'CF' || mode === 'CJ') {
                                                    console.log(state, historySights);
                                                    if ((state == 'UNBLOCKED' || mode === 'CJ') && historySights.length == 0) {
                                                        return <Form.Item><div style={{ paddingLeft: 80 }}>暂无已封禁功能</div></Form.Item>
                                                    }
                                                    return <Form.List style={{ marginBottom: 20 }} name="sights" required initialValue={[
                                                        {
                                                            riskMode: '',
                                                            timeType: '',
                                                            time: ''
                                                        }]}
                                                        rules={[
                                                            {
                                                                validator: async (_, sightsValues) => {

                                                                    const flag = sightsValues.some(item => {
                                                                        const { riskMode, value } = item
                                                                        if (riskMode && riskMode.length > 0 && !blockingRecordsByMemberIdList.hasOwnProperty(item.value)) {
                                                                            return item
                                                                        }
                                                                    })
                                                                    console.log(flag, '))))))))))))))');
                                                                    if (!flag) {
                                                                        return Promise.reject(new Error('至少选择一个处理类型'));
                                                                    }
                                                                },
                                                            }
                                                        ]}
                                                    >
                                                        {(fields, { }, { errors }) => (<>
                                                            <div style={{ paddingLeft: 60, maxHeight: 300, overflow: 'auto', margin: 20 }}>{
                                                                fields.map((field, index) => {
                                                                    return <Row>
                                                                        <Col span={24}>
                                                                            <Form.Item
                                                                                {...field}
                                                                                validateTrigger={['onChange', 'onBlur']}
                                                                                name={[field.name, 'riskMode']}
                                                                                fieldKey={[field.fieldKey, 'riskMode']}
                                                                                key={field.key}

                                                                            >
                                                                                <Checkbox.Group style={{ width: '100%' }} disabled={sights[field.name].value in blockingRecordsByMemberIdList} >
                                                                                    <Checkbox value={sights[field.name].value} >{sights[field.name].label} </Checkbox>
                                                                                </Checkbox.Group>
                                                                            </Form.Item>
                                                                        </Col>
                                                                        {
                                                                            mode === 'F' || mode === 'CF' ? <>
                                                                                <Col span={5} style={{ paddingLeft: 30 }}>
                                                                                    <Form.Item
                                                                                        shouldUpdate
                                                                                    >
                                                                                        {({ getFieldValue }) => {
                                                                                            const sights = getFieldValue("sights")
                                                                                            return sights[index].riskMode && sights[index].riskMode.length > 0 ? <Form.Item
                                                                                                name={[field.name, 'timeType']}
                                                                                                fieldKey={[field.fieldKey, 'timeType']}
                                                                                                rules={[{
                                                                                                    required: true,
                                                                                                    message: '请选择'
                                                                                                }]}
                                                                                            >
                                                                                                <Radio.Group disabled={sights[field.name].value in blockingRecordsByMemberIdList}>
                                                                                                    <Radio value="someTime">临时封禁
                                                                                                    </Radio>
                                                                                                    <br></br>
                                                                                                    <Radio value="always">永久封禁</Radio>
                                                                                                </Radio.Group>
                                                                                            </Form.Item> : null

                                                                                        }}
                                                                                    </Form.Item>

                                                                                </Col>
                                                                                <Col span={sights[field.name].value in blockingRecordsByMemberIdList ? 0 : 4} style={{ margin: '0 20px 0 0 ' }}>
                                                                                    <Form.Item
                                                                                        shouldUpdate
                                                                                        noStyle={sights[field.name].value in blockingRecordsByMemberIdList}

                                                                                    >
                                                                                        {({ getFieldValue }) => {
                                                                                            const sights = getFieldValue("sights")

                                                                                            return getFieldValue("sights") && !(sights[field.name].value in blockingRecordsByMemberIdList) && sights[index].riskMode.length > 0 ? <Form.Item
                                                                                                name={[field.name, 'time']}
                                                                                                rules={[{
                                                                                                    required: sights[index].timeType === 'someTime',
                                                                                                    message: '请选择封禁时间'
                                                                                                }]}
                                                                                                fieldKey={[field.fieldKey, 'time']}
                                                                                            >
                                                                                                {
                                                                                                    (() => {

                                                                                                        return sights[index].timeType === 'someTime' && sights[index].riskMode ?
                                                                                                            <Select size="small" style={{ width: 100, marginLeft: 20 }} options={timeOptions}
                                                                                                                disabled={sights[field.name].value in blockingRecordsByMemberIdList}
                                                                                                                placeholder="请选择" />
                                                                                                            : null
                                                                                                    })()
                                                                                                }
                                                                                            </Form.Item> : null
                                                                                        }}
                                                                                    </Form.Item>

                                                                                </Col>
                                                                                <Col span={10} >
                                                                                    <Form.Item
                                                                                        shouldUpdate
                                                                                    >
                                                                                        {({ getFieldValue }) => (
                                                                                            getFieldValue("sights") ? <Form.Item
                                                                                                name={[field.name, 'time']}
                                                                                                fieldKey={[field.fieldKey, 'time']}
                                                                                            >
                                                                                                {
                                                                                                    (() => {
                                                                                                        const sights = getFieldValue("sights")
                                                                                                        return sights[index].timeType === 'someTime' && sights[index].riskMode.length > 0 && sights[index].time ?
                                                                                                            <span>解封时间：{sights[field.name].value in blockingRecordsByMemberIdList ? blockingRecordsByMemberIdListKey2Time[sights[field.name].value] : this.getOverTime(sights[index].time)}</span>
                                                                                                            : null
                                                                                                    })()
                                                                                                }
                                                                                            </Form.Item> : null
                                                                                        )}
                                                                                    </Form.Item>
                                                                                </Col>
                                                                            </> : null
                                                                        }
                                                                    </Row>
                                                                })
                                                            }
                                                            </div>
                                                            <div style={{ paddingLeft: 80 }}><Form.ErrorList errors={errors} /></div>
                                                        </>
                                                        )}

                                                    </Form.List>
                                                } else if (state === 'WARNING') {
                                                    {/* 风控 警告 */ }

                                                    return <Form.Item style={{ marginBottom: 20 }} label="警告内容" name={'WARNINGTxt'} rules={[{ required: true, message: '请输入' }]}>
                                                        <TextArea
                                                            placeholder="请输入"
                                                            showCount
                                                            maxLength={100}
                                                        />
                                                    </Form.Item>
                                                }

                                            }
                                        }
                                    </Form.Item >

                                }
                                {
                                    <Form.Item noStyle shouldUpdate >
                                        {({ getFieldValue }) => {
                                            const state = getFieldValue('state')
                                            const timeType = getFieldValue('timeType')
                                            const reportMethod = getFieldValue('reportMethod')

                                            if (state === 'BANNED' || (mode === 'UF' && type == 'user')) {//账号封禁、解禁
                                                return <>
                                                    {
                                                        Object.keys(BANNED_state).map(key => {
                                                            return <Row style={{ paddingLeft: 80 }}>
                                                                <Col span={24}>
                                                                    <Form.Item style={{}} label="" name={'reportMethod'} rules={[{ required: true, message: '请输入' }]}>
                                                                        <Radio.Group>
                                                                            <Radio value={key}>{BANNED_state[key]}
                                                                            </Radio>
                                                                        </Radio.Group>
                                                                    </Form.Item>
                                                                </Col>
                                                                {
                                                                    reportMethod == key &&
                                                                    <>
                                                                        <Col span={5} style={{ paddingLeft: 20 }}>
                                                                            <Form.Item
                                                                                name={'timeType'}
                                                                                rules={[{ required: true, message: '请选择封禁时间' }]}
                                                                            >
                                                                                <Radio.Group>
                                                                                    <Radio value="someTime">临时封禁
                                                                                    </Radio>
                                                                                    <br></br>
                                                                                    <Radio value="always">永久封禁</Radio>
                                                                                </Radio.Group>
                                                                            </Form.Item>
                                                                        </Col>
                                                                        <Col span={16}>
                                                                            <Row style={{ margin: 0 }}>
                                                                                {
                                                                                    getFieldValue("timeType") ? <>
                                                                                        <Form.Item
                                                                                            style={{ marginRight: 20 }}
                                                                                            name={'time'}
                                                                                            rules={[{
                                                                                                required: timeType === 'someTime',
                                                                                                message: '请选择封禁时间'
                                                                                            }]}
                                                                                        >
                                                                                            {
                                                                                                (() => {
                                                                                                    return timeType === 'someTime' ?
                                                                                                        <Select size="small" style={{ width: 80, marginLeft: 20 }} options={timeOptions} placeholder="请选择" />
                                                                                                        : null
                                                                                                })()
                                                                                            }
                                                                                        </Form.Item>
                                                                                        <Form.Item
                                                                                            shouldUpdate
                                                                                        >
                                                                                            {({ getFieldValue }) => (
                                                                                                getFieldValue("timeType") === 'someTime' ? <Form.Item>
                                                                                                    {
                                                                                                        (() => {
                                                                                                            const time = getFieldValue("time")
                                                                                                            return timeType === 'someTime' && time ?
                                                                                                                <span>解封时间：{this.getOverTime(time)}</span>
                                                                                                                : null
                                                                                                        })()
                                                                                                    }
                                                                                                </Form.Item> : null
                                                                                            )}
                                                                                        </Form.Item>
                                                                                    </> : null
                                                                                }
                                                                            </Row>
                                                                        </Col>
                                                                    </>
                                                                }
                                                            </Row>
                                                        })
                                                    }
                                                </>
                                            }
                                        }}
                                    </Form.Item>
                                }
                                {
                                    mode === 'F' && type == 'content' ? <Form.Item style={{ marginBottom: 20 }} label="处理内容" name={'contentState'} rules={[{ required: true, message: '请选择' }]}>
                                        <Select options={reportStateList} placeholder="请选择" />
                                    </Form.Item> : null
                                }
                                {/* 账号封禁 */}
                                {/* {
                                    mode === 'UF' && type == 'user' ? <>
                                        <Form.Item shouldUpdate label="封禁时间" style={{ marginBottom: 20 }} required>
                                            {({ getFieldValue }) => {
                                                const timeType = getFieldValue("timeType")
                                                return <Row>
                                                    <Col span={5} style={{ paddingLeft: 30 }}>
                                                        <Form.Item
                                                            name={'timeType'}
                                                            rules={[{ required: true, message: '请选择封禁时间' }]}
                                                        >
                                                            <Radio.Group>
                                                                <Radio value="someTime">临时封禁
                                                                </Radio>
                                                                <br></br>
                                                                <Radio value="always">永久封禁</Radio>
                                                            </Radio.Group>
                                                        </Form.Item>


                                                    </Col>

                                                    <Col span={13} style={{ margin: 0 }}>
                                                        {

                                                            getFieldValue("timeType") ? <>
                                                                <Form.Item
                                                                    name={'time'}
                                                                    rules={[{
                                                                        required: timeType === 'someTime',
                                                                        message: '请选择封禁时间'
                                                                    }]}
                                                                >
                                                                    {
                                                                        (() => {
                                                                            return timeType === 'someTime' ?
                                                                                <Select size="small" style={{ width: 80, marginLeft: 20 }} options={timeOptions} placeholder="请选择" />
                                                                                : null
                                                                        })()
                                                                    }
                                                                </Form.Item>
                                                                <Form.Item
                                                                    shouldUpdate
                                                                >
                                                                    {({ getFieldValue }) => (

                                                                        getFieldValue("timeType") === 'someTime' ? <Form.Item>
                                                                            {
                                                                                (() => {
                                                                                    const time = getFieldValue("time")
                                                                                    return timeType === 'someTime' && time ?
                                                                                        <span>解封时间：{this.getOverTime(time)}</span>
                                                                                        : null
                                                                                })()
                                                                            }
                                                                        </Form.Item> : null
                                                                    )}
                                                                </Form.Item>

                                                            </> : null
                                                        }

                                                    </Col>

                                                </Row>
                                            }}

                                        </Form.Item>
                                    </> : null
                                } */}


                                {/* 风控 解禁 */}
                                {
                                    mode === 'J' ? <Form.Item shouldUpdate noStyle>
                                        {({ getFieldValue }) => {
                                            const state = getFieldValue('state')
                                            return type === 'content' ?
                                                <Form.Item style={{ marginBottom: 20 }} label="处理内容" name={'contentState'} rules={[{ required: true, message: '请选择' }]}>
                                                    <Select placeholder={"请选择"}>
                                                        {
                                                            appealContentList.map(item => {
                                                                return <Option value={item.value} >{item.label}</Option>
                                                            })
                                                        }

                                                    </Select>


                                                </Form.Item> : null

                                        }}
                                    </Form.Item> : null
                                }
                                <Form.Item style={{ marginBottom: 20 }} label="处理意见" name={'disposeOpinion'} rules={[{ required: true, message: '请输入' }]}>
                                    <TextArea
                                        placeholder="请输入"
                                        showCount
                                        maxLength={100}
                                    />
                                </Form.Item>
                                <Form.Item label="相关证明" name={'disposeImages'}  >
                                    <TheUpload getFileResult={this.getFileResult} len={4} fileList={fileList} />
                                </Form.Item>
                            </Form>
                        }

                    </Modal >
                }
            </>
        );
    }
}
